package com.example.security1.web.menu.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
@TableName("rbac_permission")
@AllArgsConstructor
@NoArgsConstructor
public class Menu {

    @TableId(type = IdType.AUTO)
    private Long pId;
    private Long parentId;
    private String parentName;
    private String title;
    private String code;
    private String name;
    private String path;
    private String url;
    private String type;
    private String icon;

    @TableField(exist = false)
    private Boolean open;

    private Integer orderNum;
    //创建时间
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    //更新时间
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private Date updateTime;

    @TableField(exist = false)
    private List<Menu> children = new ArrayList<>();
}
